package com.training.java.core.collections.immutablecar.pre15;

import java.util.*;

public class CarDemo {
	public static void main(String[] args) {

		Car car1 = new Car("Honda", "Accord", 2013);
		Car car2 = new Car("Toyota", "Camry", 2011);
		Car car3 = new Car("Mercedez", "Benz", 2014);
		Car car4 = new Car("Toyota", "Camry", 2013);

		System.out.println(car1);
		System.out.println(car2);
		System.out.println(car3);

		List carObjects = new ArrayList();

		carObjects.add(car1);
		carObjects.add(car2);
		carObjects.add(car3);
		carObjects.add(car4);

		Iterator ite = carObjects.iterator();

		while (ite.hasNext()) {
			Car car = (Car) ite.next();
			System.out.println("Car Make = " + car.getMake());
			System.out.println("Car Model = " + car.getModel());
			System.out.println("Car Year = " + car.getYear());

		}

	}

}
